package cn.com.lms.business.report.web;


//import gui.ava.html.image.generator.HtmlImageGenerator;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Tag(name = "图片报表", description = "报表数据生成图片")
@RestController
@RequestMapping("/report/image")
public class ReportToImageController {

    @Operation(summary = "网页生成图片", description = "网页生成图片")
    @GetMapping(value = "/htmlToImage")
    public  void htmlToImage( HttpServletResponse response) throws IOException {

//        response.setContentType("application/octet-stream");
//
//        response.setHeader("Content-Disposition", "attachment;fileName="+"test.png");
//
//
//        HtmlImageGenerator imageGenerator = new HtmlImageGenerator();
////        String htmlstr = FreeMarkerUtil.freeMarkerRender(null,"LearnReport.ttf");
//
//        imageGenerator.loadHtml("");
//
//        imageGenerator.getBufferedImage();
//
//        imageGenerator.saveAsImage("d:/hello-world.png");
//
//        imageGenerator.saveAsHtmlWithMap("hello-world.html", "hello-world.png");
    }

//    public static void main(String[] args) {
//        String htmlstr = null;
//        String path="/resources/template/";
//        try {
//
//            htmlstr = FreeMarkerUtil.freeMarkerRender(null,"learnreport.ftl");
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        System.out.println(htmlstr);
//    }
}
